<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateWechatMessageTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('wechat_message', function(Blueprint $table)
		{
			$table->increments('id');
			$table->integer('wechat_id')->unsigned()->comment('公众号ID');
			$table->smallInteger('public')->default(0)->comment('public');
			$table->char('wid', 64)->comment('微信ID');
			$table->string('to', 64)->comment('微信号');
			$table->string('from', 64)->comment('发送方帐号');
			$table->integer('response')->unsigned()->comment('发送方帐号');
			$table->text('content', 65535)->comment('消息内容');
			$table->char('type', 32)->comment('类型');
			$table->boolean('replied')->default(0)->comment('回复ID');
			$table->dateTime('time')->comment('消息时间');
			$table->timestamps();
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('wechat_message');
	}

}
